package com.nc.delivery_project.client.cargo_details;

import com.google.gwt.core.shared.GWT;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.google.gwt.place.shared.Prefix;
import com.google.web.bindery.requestfactory.shared.RequestFactory;

/**
* Created with IntelliJ IDEA.
* User: Natalie D.
* Date: 1/27/15
* Time: 2:04 PM
*/
public class CargoDetailsPlace extends Place {

    @Prefix("cargo_details")
    public static class Tokenizer implements PlaceTokenizer<CargoDetailsPlace> {

        private RequestFactory requestFactory;

        public Tokenizer(RequestFactory requestFactory) {
            this.requestFactory = requestFactory;
        }

        @Override
        public String getToken(CargoDetailsPlace place) {
            return place.getToken();
        }

        @Override
        public CargoDetailsPlace getPlace(String token) {
            GWT.log(token);
            return new CargoDetailsPlace(token);
        }

    }

    private String token;

    public CargoDetailsPlace(String token) {
        this.token = token;
    }

    public String getToken() {
        return token;
    }
}
